﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
using DiemChapNhanThe.Entities;
using DiemChapNhanThe.Data;

/// <summary>
/// Summary description for BindCatalog
/// </summary>
public class BindCatalog
{
	public BindCatalog()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public static void BindLoaiHoTro(DropDownList cboCatalog)
    {
        TList<LoaiHoTro> TList_Catalog = DataRepository.LoaiHoTroProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenLoaiHoTro";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Loại Hỗ trợ --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }
    public static void BindLoaiMatHang(DropDownList cboCatalog)
    {
        TList<LoaiMatHang> TList_Catalog = DataRepository.LoaiMatHangProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenMatHang";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Loại mặt hàng --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }
    public static void BindDiaPhuong(DropDownList cboCatalog)
    {
        TList<DiaPhuong> TList_Catalog = DataRepository.DiaPhuongProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenDiaPhuong";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Địa phương --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }
    public static void BindSubMatHang(DropDownList cboCatalog)
    {
        TList<SubMatHang> TList_Catalog = DataRepository.SubMatHangProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenSubMatHang";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Sub mặt hàng --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }
    public static void BindLoaiQuangCao(DropDownList cboCatalog)
    {
        TList<LoaiQuangCao> TList_Catalog = DataRepository.LoaiQuangCaoProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenLoaiQuangCao";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Loại quảng cáo --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }
    public static void BindLoaiCongTy(DropDownList cboCatalog)
    {
        TList<LoaiCongTy> TList_Catalog = DataRepository.LoaiCongTyProvider.GetAll();
        cboCatalog.DataSource = TList_Catalog;
        cboCatalog.DataTextField = "TenLoaiCongTy";
        cboCatalog.DataValueField = "Id";
        cboCatalog.DataBind();
        ListItem ItemChoose = new ListItem();
        ItemChoose.Text = " -- Loại công ty --";
        ItemChoose.Value = "0";
        cboCatalog.Items.Insert(0, ItemChoose);
    }
}